<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>合约交友 - 寻找你的理想的伙伴</title>
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome 图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
    
    <style>
        :root {
            --primary: #5b21b6; /* 主色调：深紫色 */
            --primary-light: #a78bfa;
            --primary-dark: #4c1d95;
            --secondary: #0ea5e9; /* 辅助色：蓝色 */
            --accent: #f97316; /* 强调色：橙色 */
            --success: #10b981;
            --danger: #ef4444;
            --text-primary: #1e293b;
            --text-secondary: #64748b;
            --bg-light: #f8fafc;
            --bg-white: #ffffff;
            --border-light: #e2e8f0;
            --radius: 12px;
            --shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background-color: var(--bg-light);
            color: var(--text-primary);
            padding-top: 55px;
            padding-bottom: 70px;
        }
        
        /* 顶部导航 */
        .top-nav {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 55px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 15px;
            z-index: 1000;
            border-bottom: 1px solid var(--border-light);
            box-shadow: var(--shadow);
        }
        
        .nav-title {
            font-size: 1.15rem;
            font-weight: 600;
            color: var(--primary-dark);
        }
        
        .nav-action {
            color: var(--text-secondary);
            background: none;
            border: none;
            font-size: 1.2rem;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .nav-action:hover {
            background-color: var(--bg-light);
        }
        
        /* 搜索栏 */
        .search-container {
            padding: 12px 15px;
            background-color: var(--bg-white);
        }
        
        .search-box {
            position: relative;
            display: flex;
            align-items: center;
        }
        
        .search-input {
            flex: 1;
            padding: 10px 15px 10px 40px;
            border-radius: 25px;
            border: 1px solid var(--border-light);
            background-color: var(--bg-light);
            font-size: 0.9rem;
        }
        
        .search-input:focus {
            outline: none;
            border-color: var(--primary-light);
        }
        
        .search-icon {
            position: absolute;
            left: 15px;
            color: var(--text-secondary);
            font-size: 0.95rem;
        }
        
        /* 筛选工具栏 */
        .filter-toolbar {
            padding: 8px 15px;
            background-color: var(--bg-white);
            border-top: 1px solid var(--border-light);
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
        }
        
        .filter-toolbar::-webkit-scrollbar {
            display: none;
        }
        
        .category-tabs {
            display: flex;
            gap: 10px;
            padding: 5px 0;
        }
        
        .category-tab {
            white-space: nowrap;
            padding: 6px 14px;
            border-radius: 20px;
            font-size: 0.85rem;
            font-weight: 500;
            background-color: var(--bg-light);
            color: var(--text-secondary);
            border: none;
        }
        
        .category-tab.active {
            background-color: var(--primary);
            color: white;
        }
        
        /* 快捷筛选 */
        .quick-filters {
            display: flex;
            padding: 10px 15px;
            background-color: var(--bg-white);
            border-top: 1px solid var(--border-light);
            gap: 10px;
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
        }
        
        .quick-filters::-webkit-scrollbar {
            display: none;
        }
        
        .quick-filter {
            flex: 0 0 auto;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
            color: var(--text-secondary);
            background: none;
            border: none;
            font-size: 0.7rem;
            padding: 5px 8px;
        }
        
        .quick-filter i {
            font-size: 1.1rem;
            width: 30px;
            height: 30px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            background-color: var(--bg-light);
        }
        
        .quick-filter.active {
            color: var(--primary);
        }
        
        .quick-filter.active i {
            background-color: rgba(91, 33, 182, 0.1);
            color: var(--primary);
        }
        
        /* 列表容器 */
        .contract-list {
            padding: 10px 15px;
        }
        
        /* 合约交友卡片 - 通用样式 */
        .contract-card {
            background-color: var(--bg-white);
            border-radius: var(--radius);
            margin-bottom: 12px;
            overflow: hidden;
            box-shadow: var(--shadow);
            transition: transform 0.2s ease;
        }
        
        .contract-card:hover {
            transform: translateY(-2px);
        }
        
        .contract-header {
            padding: 12px 15px;
            display: flex;
            align-items: center;
            gap: 12px;
            border-bottom: 1px solid var(--border-light);
        }
        
        .user-avatar {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            object-fit: cover;
            border: 2px solid var(--primary-light);
        }
        
        .user-info {
            flex: 1;
        }
        
        .user-name {
            font-weight: 600;
            font-size: 1rem;
            display: flex;
            align-items: center;
            gap: 5px;
        }
        
        .verify-badge {
            color: var(--primary);
            font-size: 0.8rem;
        }
        
        .user-meta {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            font-size: 0.75rem;
            color: var(--text-secondary);
            margin-top: 3px;
        }
        
        .contract-tags {
            display: flex;
            flex-wrap: wrap;
            gap: 5px;
            margin-top: 5px;
        }
        
        .contract-tag {
            padding: 2px 8px;
            border-radius: 10px;
            font-size: 0.7rem;
            background-color: rgba(91, 33, 182, 0.1);
            color: var(--primary);
        }
        
        .contract-content {
            padding: 12px 15px;
        }
        
        .contract-title {
            font-weight: 600;
            font-size: 0.95rem;
            margin-bottom: 8px;
            color: var(--text-primary);
        }
        
        .contract-description {
            font-size: 0.85rem;
            color: var(--text-secondary);
            line-height: 1.5;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }
        
        .contract-actions {
            display: flex;
            justify-content: space-between;
            padding: 10px 15px;
            border-top: 1px solid var(--border-light);
        }
        
        .action-btn {
            padding: 6px 14px;
            border-radius: 20px;
            font-size: 0.85rem;
            font-weight: 500;
            display: flex;
            align-items: center;
            gap: 5px;
        }
        
        .primary-action {
            background-color: var(--primary);
            color: white;
            border: none;
        }
        
        .secondary-action {
            background-color: transparent;
            color: var(--text-secondary);
            border: 1px solid var(--border-light);
        }
        
        /* 无图片合约卡片 */
        .contract-card.no-image .contract-content {
            padding-bottom: 15px;
        }
        
        /* 单图片合约卡片 */
        .contract-card.single-image .media-container {
            width: 100%;
            height: 180px;
            position: relative;
        }
        
        .contract-card.single-image .media-container img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        /* 多图片合约卡片 */
        .contract-card.multi-image .media-container {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 3px;
        }
        
        .contract-card.multi-image .media-container img {
            width: 100%;
            aspect-ratio: 1/1;
            object-fit: cover;
        }
        
        .image-count {
            position: absolute;
            top: 8px;
            right: 8px;
            background-color: rgba(0, 0, 0, 0.6);
            color: white;
            padding: 2px 6px;
            border-radius: 10px;
            font-size: 0.7rem;
        }
        
        /* 合约详情信息 */
        .contract-details {
            display: flex;
            flex-wrap: wrap;
            gap: 12px;
            margin: 10px 0;
            padding: 10px 0;
            border-top: 1px dashed var(--border-light);
            border-bottom: 1px dashed var(--border-light);
        }
        
        .detail-item {
            flex: 1;
            min-width: 100px;
            font-size: 0.8rem;
        }
        
        .detail-label {
            color: var(--text-secondary);
            margin-bottom: 2px;
            font-size: 0.75rem;
        }
        
        .detail-value {
            font-weight: 500;
            color: var(--text-primary);
        }
        
        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 65px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-around;
            align-items: center;
            border-top: 1px solid var(--border-light);
            z-index: 1000;
        }
        
        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: var(--text-secondary);
            font-size: 0.7rem;
            text-decoration: none;
        }
        
        .nav-item i {
            font-size: 1.3rem;
            margin-bottom: 3px;
        }
        
        .nav-item.active {
            color: var(--primary);
        }
        
        /* 创建合约按钮 */
        .create-contract-btn {
            position: fixed;
            right: 20px;
            bottom: 80px;
            width: 56px;
            height: 56px;
            border-radius: 50%;
            background-color: var(--accent);
            color: white;
            border: none;
            box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5rem;
            z-index: 900;
        }
        
        /* 提示消息 */
        .toast-notification {
            position: fixed;
            bottom: 80px;
            left: 50%;
            transform: translateX(-50%);
            background-color: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 8px 16px;
            border-radius: 4px;
            z-index: 9999;
            font-size: 0.85rem;
            opacity: 0;
            transition: opacity 0.3s ease;
        }
        
        .toast-notification.show {
            opacity: 1;
        }
        
        /* 加载更多 */
        .load-more {
            width: 100%;
            padding: 12px;
            margin: 10px 0 20px;
            background-color: var(--bg-white);
            border: 1px solid var(--border-light);
            border-radius: var(--radius);
            color: var(--text-secondary);
            font-size: 0.9rem;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }
        
        /* 空状态 */
        .empty-state {
            padding: 50px 20px;
            text-align: center;
            color: var(--text-secondary);
        }
        
        .empty-state i {
            font-size: 3.5rem;
            margin-bottom: 20px;
            color: var(--border-light);
        }
        
        .empty-state p {
            margin-bottom: 25px;
            font-size: 0.95rem;
        }
        
        .empty-state button {
            background-color: var(--primary);
            color: white;
            border: none;
            padding: 9px 20px;
            border-radius: 20px;
            font-size: 0.9rem;
        }
    </style>
</head>
<body>
    <!-- 顶部导航 -->
    <div class="top-nav">
        <button class="nav-action" id="backBtn">
            <i class="fas fa-arrow-left"></i>
        </button>
        <div class="nav-title">合约交友</div>
        <button class="nav-action" id="filterBtn">
            <i class="fas fa-sliders"></i>
        </button>
    </div>
    
    <!-- 搜索栏 -->
    <div class="search-container">
        <div class="search-box">
            <i class="fas fa-search search-icon"></i>
            <input type="text" class="search-input" placeholder="搜索合约类型、兴趣或用户...">
        </div>
    </div>
    
    <!-- 分类筛选 -->
    <div class="filter-toolbar">
        <div class="category-tabs">
            <button class="category-tab active">全部合约</button>
            <button class="category-tab">短期陪伴</button>
            <button class="category-tab">兴趣伙伴</button>
            <button class="category-tab">学习搭档</button>
            <button class="category-tab">旅行同伴</button>
            <button class="category-tab">活动邀约</button>
            <button class="category-tab">技能交换</button>
        </div>
    </div>
    
    <!-- 快捷筛选 -->
    <div class="quick-filters">
        <button class="quick-filter active">
            <i class="fas fa-clock"></i>
            <span>最新</span>
        </button>
        <button class="quick-filter">
            <i class="fas fa-map-marker-alt"></i>
            <span>附近</span>
        </button>
        <button class="quick-filter">
            <i class="fas fa-image"></i>
            <span>有图</span>
        </button>
        <button class="quick-filter">
            <i class="fas fa-star"></i>
            <span>优质</span>
        </button>
        <button class="quick-filter">
            <i class="fas fa-bolt"></i>
            <span>紧急</span>
        </button>
        <button class="quick-filter">
            <i class="fas fa-money-bill-wave"></i>
            <span>付费</span>
        </button>
        <button class="quick-filter">
            <i class="fas fa-calendar-day"></i>
            <span>本周</span>
        </button>
    </div>
    
    <!-- 合约列表 -->
    <div class="contract-list" id="contractList">
        <!-- 多图合约卡片 -->
        <div class="contract-card multi-image">
            <div class="contract-header">
                <img src="https://picsum.photos/id/64/100/100" alt="用户头像" class="user-avatar">
                <div class="user-info">
                    <div class="user-name">
                        旅行家小A
                        <span class="verify-badge"><i class="fas fa-check-circle"></i></span>
                    </div>
                    <div class="user-meta">
                        <span>26岁</span>
                        <span>·</span>
                        <span>女</span>
                        <span>·</span>
                        <span>距离3.5km</span>
                    </div>
                    <div class="contract-tags">
                        <span class="contract-tag">旅行同伴</span>
                        <span class="contract-tag">7天</span>
                    </div>
                </div>
            </div>
            
            <div class="media-container">
                <img src="https://picsum.photos/id/10/400/400" alt="旅行照片1">
                <img src="https://picsum.photos/id/20/400/400" alt="旅行照片2">
                <img src="https://picsum.photos/id/30/400/400" alt="旅行照片3">
            </div>
            
            <div class="contract-content">
                <h3 class="contract-title">寻找云南大理7日游同伴，AA制</h3>
                <p class="contract-description">
                    计划下月初去大理旅行，寻找一位性格开朗、喜欢摄影的同伴，行程可以一起商量，费用AA制，希望能有个愉快的旅程。
                </p>
                
                <div class="contract-details">
                    <div class="detail-item">
                        <div class="detail-label">开始日期</div>
                        <div class="detail-value">6月10日</div>
                    </div>
                    <div class="detail-item">
                        <div class="detail-label">预算</div>
                        <div class="detail-value">3000元/人</div>
                    </div>
                    <div class="detail-item">
                        <div class="detail-label">要求</div>
                        <div class="detail-value">爱干净、有耐心</div>
                    </div>
                </div>
            </div>
            
            <div class="contract-actions">
                <button class="action-btn secondary-action">
                    <i class="far fa-heart"></i>
                    <span>收藏</span>
                </button>
                <button class="action-btn primary-action">
                    <i class="fas fa-handshake"></i>
                    <span>联系TA</span>
                </button>
            </div>
        </div>
        
        <!-- 单图合约卡片 -->
        <div class="contract-card single-image">
            <div class="contract-header">
                <img src="https://picsum.photos/id/91/100/100" alt="用户头像" class="user-avatar">
                <div class="user-info">
                    <div class="user-name">
                        健身达人阿强
                        <span class="verify-badge"><i class="fas fa-check-circle"></i></span>
                    </div>
                    <div class="user-meta">
                        <span>28岁</span>
                        <span>·</span>
                        <span>男</span>
                        <span>·</span>
                        <span>距离1.2km</span>
                    </div>
                    <div class="contract-tags">
                        <span class="contract-tag">兴趣伙伴</span>
                        <span class="contract-tag">长期</span>
                    </div>
                </div>
            </div>
            
            <div class="media-container">
                <img src="https://picsum.photos/id/26/800/400" alt="健身照片">
                <div class="image-count">1/1</div>
            </div>
            
            <div class="contract-content">
                <h3 class="contract-title">寻找健身搭档，一起锻炼互相监督</h3>
                <p class="contract-description">
                    每周一、三、五晚上7点在阳光健身房锻炼，寻找一位能长期坚持的搭档，互相鼓励监督，共同进步。我可以指导基础动作。
                </p>
                
                <div class="contract-details">
                    <div class="detail-item">
                        <div class="detail-label">地点</div>
                        <div class="detail-value">阳光健身房</div>
                    </div>
                    <div class="detail-item">
                        <div class="detail-label">频率</div>
                        <div class="detail-value">每周3次</div>
                    </div>
                    <div class="detail-item">
                        <div class="detail-label">类型</div>
                        <div class="detail-value">力量训练</div>
                    </div>
                </div>
            </div>
            
            <div class="contract-actions">
                <button class="action-btn secondary-action">
                    <i class="far fa-heart"></i>
                    <span>收藏</span>
                </button>
                <button class="action-btn primary-action">
                    <i class="fas fa-handshake"></i>
                    <span>联系TA</span>
                </button>
            </div>
        </div>
        
        <!-- 无图合约卡片 -->
        <div class="contract-card no-image">
            <div class="contract-header">
                <img src="https://picsum.photos/id/26/100/100" alt="用户头像" class="user-avatar">
                <div class="user-info">
                    <div class="user-name">
                        学霸小雨
                    </div>
                    <div class="user-meta">
                        <span>22岁</span>
                        <span>·</span>
                        <span>女</span>
                        <span>·</span>
                        <span>距离5.8km</span>
                    </div>
                    <div class="contract-tags">
                        <span class="contract-tag">学习搭档</span>
                        <span class="contract-tag">3个月</span>
                    </div>
                </div>
            </div>
            
            <div class="contract-content">
                <h3 class="contract-title">寻找考研学习搭档，互相督促共同进步</h3>
                <p class="contract-description">
                    准备参加明年考研，目标是北京大学计算机系，寻找一位同样备考的同学一起学习，每天在市图书馆自习，互相解答问题，共同进步。
                </p>
                
                <div class="contract-details">
                    <div class="detail-item">
                        <div class="detail-label">地点</div>
                        <div class="detail-value">市图书馆</div>
                    </div>
                    <div class="detail-item">
                        <div class="detail-label">时间</div>
                        <div class="detail-value">每天9:00-18:00</div>
                    </div>
                    <div class="detail-item">
                        <div class="detail-label">专业</div>
                        <div class="detail-value">计算机</div>
                    </div>
                </div>
            </div>
            
            <div class="contract-actions">
                <button class="action-btn secondary-action">
                    <i class="far fa-heart"></i>
                    <span>收藏</span>
                </button>
                <button class="action-btn primary-action">
                    <i class="fas fa-handshake"></i>
                    <span>联系TA</span>
                </button>
            </div>
        </div>
        
        <!-- 多图合约卡片 -->
        <div class="contract-card multi-image">
            <div class="contract-header">
                <img src="https://picsum.photos/id/65/100/100" alt="用户头像" class="user-avatar">
                <div class="user-info">
                    <div class="user-name">
                        美食家老周
                        <span class="verify-badge"><i class="fas fa-check-circle"></i></span>
                    </div>
                    <div class="user-meta">
                        <span>32岁</span>
                        <span>·</span>
                        <span>男</span>
                        <span>·</span>
                        <span>距离2.7km</span>
                    </div>
                    <div class="contract-tags">
                        <span class="contract-tag">活动邀约</span>
                        <span class="contract-tag">1天</span>
                    </div>
                </div>
            </div>
            
            <div class="media-container">
                <img src="https://picsum.photos/id/42/400/400" alt="美食照片1">
                <img src="https://picsum.photos/id/43/400/400" alt="美食照片2">
                <img src="https://picsum.photos/id/44/400/400" alt="美食照片3">
            </div>
            
            <div class="contract-content">
                <h3 class="contract-title">本周末美食探店活动，寻找3位美食爱好者</h3>
                <p class="contract-description">
                    本周末计划探访城南新开的几家特色餐厅，从中午开始到晚上，寻找3位喜欢美食、爱拍照的朋友一起，费用AA，每人预算约300元。
                </p>
                
                <div class="contract-details">
                    <div class="detail-item">
                        <div class="detail-label">时间</div>
                        <div class="detail-value">周六 12:00</div>
                    </div>
                    <div class="detail-item">
                        <div class="detail-label">人数</div>
                        <div class="detail-value">还缺2人</div>
                    </div>
                    <div class="detail-item">
                        <div class="detail-label">菜系</div>
                        <div class="detail-value">创意菜、日料</div>
                    </div>
                </div>
            </div>
            
            <div class="contract-actions">
                <button class="action-btn secondary-action">
                    <i class="far fa-heart"></i>
                    <span>收藏</span>
                </button>
                <button class="action-btn primary-action">
                    <i class="fas fa-handshake"></i>
                    <span>联系TA</span>
                </button>
            </div>
        </div>
        
        <!-- 无图合约卡片 -->
        <div class="contract-card no-image">
            <div class="contract-header">
                <img src="https://picsum.photos/id/62/100/100" alt="用户头像" class="user-avatar">
                <div class="user-info">
                    <div class="user-name">
                        程序员小林
                    </div>
                    <div class="user-meta">
                        <span>29岁</span>
                        <span>·</span>
                        <span>男</span>
                        <span>·</span>
                        <span>距离8.3km</span>
                    </div>
                    <div class="contract-tags">
                        <span class="contract-tag">技能交换</span>
                        <span class="contract-tag">长期</span>
                    </div>
                </div>
            </div>
            
            <div class="contract-content">
                <h3 class="contract-title">用编程技能交换英语口语练习</h3>
                <p class="contract-description">
                    本人是资深程序员，擅长Python、Java等编程语言，希望能找到一位英语母语者或英语流利的朋友，我可以教你编程，你帮我练习英语口语。
                </p>
                
                <div class="contract-details">
                    <div class="detail-item">
                        <div class="detail-label">方式</div>
                        <div class="detail-value">线上/线下均可</div>
                    </div>
                    <div class="detail-item">
                        <div class="detail-label">频率</div>
                        <div class="detail-value">每周2次</div>
                    </div>
                    <div class="detail-item">
                        <div class="detail-label">时长</div>
                        <div class="detail-value">每次1小时</div>
                    </div>
                </div>
            </div>
            
            <div class="contract-actions">
                <button class="action-btn secondary-action">
                    <i class="far fa-heart"></i>
                    <span>收藏</span>
                </button>
                <button class="action-btn primary-action">
                    <i class="fas fa-handshake"></i>
                    <span>联系TA</span>
                </button>
            </div>
        </div>
        
        <!-- 加载更多 -->
        <button class="load-more" id="loadMore">
            <i class="fas fa-spinner fa-spin"></i>
            <span>加载更多合约</span>
        </button>
    </div>
    
    <!-- 创建合约按钮 -->
    <button class="create-contract-btn" id="createContractBtn">
        <i class="fas fa-plus"></i>
    </button>
    
    <!-- 底部导航 -->
    <div class="bottom-nav">
        <a href="#" class="nav-item">
            <i class="fas fa-home"></i>
            <span>首页</span>
        </a>
        <a href="#" class="nav-item active">
            <i class="fas fa-handshake"></i>
            <span>合约</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-comments"></i>
            <span>消息</span>
        </a>
        <a href="#" class="nav-item">
            <i class="far fa-user"></i>
            <span>我的</span>
        </a>
    </div>
    
    <!-- Bootstrap JS Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
    
    <script>
        // 提示消息
        function showToast(message) {
            let toast = document.querySelector('.toast-notification');
            if (toast) {
                toast.remove();
            }
            
            toast = document.createElement('div');
            toast.className = 'toast-notification';
            toast.textContent = message;
            
            document.body.appendChild(toast);
            
            setTimeout(() => {
                toast.classList.add('show');
            }, 10);
            
            setTimeout(() => {
                toast.classList.remove('show');
                setTimeout(() => toast.remove(), 300);
            }, 2500);
        }
        
        // 搜索功能
        document.querySelector('.search-input').addEventListener('keypress', function(e) {
            if (e.key === 'Enter' && this.value.trim() !== '') {
                showToast(`搜索: ${this.value.trim()}`);
                simulateLoading();
            }
        });
        
        // 分类标签筛选
        const categoryTabs = document.querySelectorAll('.category-tab');
        categoryTabs.forEach(tab => {
            tab.addEventListener('click', () => {
                categoryTabs.forEach(t => t.classList.remove('active'));
                tab.classList.add('active');
                showToast(`已选择: ${tab.textContent}`);
                simulateLoading();
            });
        });
        
        // 快捷筛选按钮
        const quickFilters = document.querySelectorAll('.quick-filter');
        quickFilters.forEach(filter => {
            filter.addEventListener('click', () => {
                filter.classList.toggle('active');
                const filterText = filter.querySelector('span').textContent;
                
                if (filter.classList.contains('active')) {
                    showToast(`已筛选: ${filterText}`);
                } else {
                    showToast(`已取消筛选: ${filterText}`);
                }
                
                simulateLoading();
            });
        });
        
        // 收藏按钮功能
        document.querySelectorAll('.action-btn.secondary-action').forEach(btn => {
            btn.addEventListener('click', function() {
                const icon = this.querySelector('i');
                const contractTitle = this.closest('.contract-card').querySelector('.contract-title').textContent;
                
                if (icon.classList.contains('far')) {
                    icon.classList.remove('far');
                    icon.classList.add('fas');
                    this.style.color = 'var(--danger)';
                    showToast(`已收藏 "${contractTitle}"`);
                } else {
                    icon.classList.remove('fas');
                    icon.classList.add('far');
                    this.style.color = 'var(--text-secondary)';
                    showToast(`已取消收藏 "${contractTitle}"`);
                }
            });
        });
        
        // 联系按钮功能
        document.querySelectorAll('.action-btn.primary-action').forEach(btn => {
            btn.addEventListener('click', function() {
                const userName = this.closest('.contract-card').querySelector('.user-name').textContent.trim();
                showToast(`正在联系 ${userName}...`);
            });
        });
        
        // 卡片点击查看详情
        document.querySelectorAll('.contract-card').forEach(card => {
            card.addEventListener('click', function(e) {
                // 避免点击按钮时触发卡片点击事件
                if (!e.target.closest('.action-btn')) {
                    const contractTitle = this.querySelector('.contract-title').textContent;
                    showToast(`查看 "${contractTitle}" 详情`);
                }
            });
        });
        
        // 加载更多
        document.getElementById('loadMore').addEventListener('click', function() {
            const btn = this;
            const originalText = btn.innerHTML;
            btn.innerHTML = '<i class="fas fa-spinner fa-spin"></i><span>加载中...</span>';
            btn.disabled = true;
            
            setTimeout(() => {
                btn.innerHTML = originalText;
                btn.disabled = false;
                showToast('已加载更多合约');
                
                // 复制并修改第一个卡片添加到列表
                const contractList = document.getElementById('contractList');
                const firstCard = contractList.querySelector('.contract-card:first-of-type');
                
                if (firstCard) {
                    const clone = firstCard.cloneNode(true);
                    const randomId = Math.floor(Math.random() * 300) + 100;
                    clone.querySelector('.user-avatar').src = `https://picsum.photos/id/${randomId}/100/100`;
                    
                    // 随机更改一些内容
                    const titles = [
                        "寻找羽毛球搭档，每周两次",
                        "周末爬山活动，寻找同行者",
                        "想学钢琴，可用吉他技能交换",
                        "寻找日语学习伙伴，有N2水平"
                    ];
                    const randomTitle = titles[Math.floor(Math.random() * titles.length)];
                    clone.querySelector('.contract-title').textContent = randomTitle;
                    
                    contractList.insertBefore(clone, btn);
                    
                    // 重新绑定事件
                    bindCardEvents(clone);
                }
            }, 1500);
        });
        
        // 绑定卡片事件
        function bindCardEvents(card) {
            // 收藏按钮
            card.querySelector('.action-btn.secondary-action').addEventListener('click', function() {
                const icon = this.querySelector('i');
                const contractTitle = this.closest('.contract-card').querySelector('.contract-title').textContent;
                
                if (icon.classList.contains('far')) {
                    icon.classList.remove('far');
                    icon.classList.add('fas');
                    this.style.color = 'var(--danger)';
                    showToast(`已收藏 "${contractTitle}"`);
                } else {
                    icon.classList.remove('fas');
                    icon.classList.add('far');
                    this.style.color = 'var(--text-secondary)';
                    showToast(`已取消收藏 "${contractTitle}"`);
                }
            });
            
            // 联系按钮
            card.querySelector('.action-btn.primary-action').addEventListener('click', function() {
                const userName = this.closest('.contract-card').querySelector('.user-name').textContent.trim();
                showToast(`正在联系 ${userName}...`);
            });
            
            // 卡片点击
            card.addEventListener('click', function(e) {
                if (!e.target.closest('.action-btn')) {
                    const contractTitle = this.querySelector('.contract-title').textContent;
                    showToast(`查看 "${contractTitle}" 详情`);
                }
            });
        }
        
        // 创建合约按钮
        document.getElementById('createContractBtn').addEventListener('click', () => {
            showToast('创建新合约');
        });
        
        // 返回按钮
        document.getElementById('backBtn').addEventListener('click', () => {
            showToast('返回上一页');
        });
        
        // 筛选按钮
        document.getElementById('filterBtn').addEventListener('click', () => {
            showToast('打开高级筛选');
        });
        
        // 页面加载完成后初始化
        window.addEventListener('DOMContentLoaded', () => {
            // 初始加载时隐藏加载动画
            document.querySelector('.load-more i').classList.remove('fa-spin');
        });
        
        // 模拟加载状态
        function simulateLoading() {
            const contractList = document.getElementById('contractList');
            const originalContent = contractList.innerHTML;
            
            contractList.innerHTML = `
                <div class="d-flex justify-content-center p-5">
                    <div class="spinner-border text-primary" role="status">
                        <span class="visually-hidden">Loading...</span>
                    </div>
                </div>
            `;
            
            setTimeout(() => {
                contractList.innerHTML = originalContent;
            }, 800);
        }
    </script>
</body>
</html>

